package cn.com.lyb.enums;

public enum JobStatusEnum {
    NOT_STARTED("1", "未开始"),
    IN_PROGRESS("2", "进行中"),
    SUCCESS("3", "成功"),
    FAILED("4", "失败");

    private final String code;
    private final String description;

    JobStatusEnum(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static JobStatusEnum fromCode(String code) {
        for (JobStatusEnum status : values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        throw new IllegalArgumentException("Invalid code: " + code);
    }
}
